package com.web44.mybatisplus;

import com.web44.mybatisplus.bean.User;
import com.web44.mybatisplus.mapper.UserMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @Title: MybatisTest01
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/3/5 10:59
 */
@SpringBootTest
public class MybatisTest01 {

    @Autowired
    private UserMapper userMapper;

    @Test
    public void func01() {
//        User user = userMapper.selectById(1L);
//        System.out.println(user);

        List<User> users = userMapper.selectList(null);
        users.forEach(System.out::println);

    }

    @Test
    public void func02() {

        User user = new User("寒梅",18,"xxx");
        userMapper.insert(user);

    }

    @Test
    public void func03() {
        userMapper.deleteById(8L);
    }
}
